require(['./config'],()=>{
    require(['header','footer','jquery','jqcookie'],()=>{
        class sign{
            constructor(){
               this.getsign() 
            }
            getsign(){
              $('#lj-sign').on('click',()=>{
                const tel = $('#tel').val()
                const pwd = $('#pwd').val()
                let userList = localStorage.getItem('userList')
                if(userList){
                    userList = JSON.parse(userList)
                    const isExit = userList.some(item=>{
                        return item.tel === tel && item.pwd === pwd
                    })
                    if(isExit){
                        $.cookie('tel',tel,{
                            expires: 7,
                            path: '/'
                        })
                        alert('登录成功')
                        location.href = '/index.html' 
                    }
                    else{
                        alert('登录失败')
                    }
                }else{
                    alert('登录失败')
                }
              })
            }
        }
        new sign()
    })
})